<template>
	<div style="width:400px;margin:0 auto;margin-top:10px;padding:40px 20px;">
		<form>
			<div style="text-align:center;">
				<img src="../assets/login-logo.png" style="width:190px;height:176px;"/>
				<el-row v-show="false">
					<el-col :span="6">公司名称</el-col>
					<el-col :span="18"><el-input v-model="companyName" size="small"></el-input></el-col>
				</el-row>
				
				<el-row style="margin-top: 10px;" v-show="false">
					<el-col :span="6">管理员密码</el-col>
					<el-col :span="18"><el-input v-model="password" size="small" type="password"></el-input></el-col>
				</el-row>
				
				<el-row style="margin-top: 10px;" v-show="false">
					<el-col :span="6">管理员重复密码2</el-col>
					<el-col :span="18"><el-input v-model="password2" size="small" type="password"></el-input></el-col>
				</el-row>
				
				<el-row style="margin-top: 10px;">
					<el-button type="primary" size="small" style="background-color: #7C7BAD;border-color: #7C7BAD;" @click="onOK"  v-loading.fullscreen.lock="fullscreenLoading">安装</el-button>
				</el-row>
			</div>
		</form>
	</div>
</template>

<script>
	import restUtil from '@/utils/restUtil.js';
	export default {
		name: "InitDB",
		data() {
			return {
				companyName:"",
				password:"",
				password2:"",
				fullscreenLoading: false
			}
		},methods: {
			onOK() {
				this.fullscreenLoading=true;
				let config = {
					headers: {
						'X-Token': ''
					}
				};
				var that=this;
				restUtil.postAction(this,"sys/initdb/initdb",  {
					companyName: this.companyName,
					password: this.password,
					password2:this.password2
				},config).then(function(response){
					if (response.data.code == 1) {
						that.$router.push("/");
					}else if(response.data.code==0){
						that.$alert(response.data.message, "提示");
					}
					that.fullscreenLoading=false;
				});
			}
		},
	}
</script>

<style>
</style>
